<?php
class adminmenuModel extends commonModel
{
    public function __construct()
    {
        parent::__construct();
    }

    //获取栏目树形列表
    public function menu_list($id = 0) {
        $sql="
        SELECT *
        FROM {$this->model->pre}admin_menu
        ORDER BY id ASC
        ";
        $data=$this->model->query($sql); 

        $cat = new Category(array('id', 'pid', 'name', 'cname'));
        return $cat->getTree($data, $id);
    }

    //获取自定义变量内容
    public function info($id)
    {
        return $this->model->table('admin_menu')->where('id='.$id)->find();
    }

    //添加自定义变量内容
    public function add($data)
    {
        return $this->model->table('admin_menu')->data($data)->insert();
    }

    //编辑自定义变量内容
    public function edit($data)
    {
        $condition['id']=intval($data['id']);
        return $this->model->table('admin_menu')->data($data)->where($condition)->update(); 
    }

    //删除自定义变量内容
    public function del($id)
    {
        return $this->model->table('admin_menu')->where('id='.intval($id))->delete(); 
    }

}

?>